#define _CRT_SECURE_NO_WARNINGS	

#include<stdio.h>

int main()
{
    double s;
    int t;
    scanf("%lf%d", &s, &t);
    double sum = 0;
    if (s <= 3)
        sum = 10;
    else if (s <= 13)
        sum = 10 + (s - 3) * 2;
    else
        sum = 10 + 2 * 10 + (s - 13) * 3;
    sum += t / 5 * 2;
    printf("%.0f", sum);
    return 0;
}